/* ScraperSessionInterfaceMock.java
 * 5 Jun 2012
 * 
 */
package za.ac.wits.elen7045.integrity.test.mock;

import java.util.ArrayList;
import java.util.Calendar;

import za.ac.wits.elen7045.scraper.interfaces.ScrapeDataPairInterface;
import za.ac.wits.elen7045.scraper.interfaces.ScraperSessionInterface;

/**
 * This is a mock object used for unit testing in APS Integrity Checker
 * @author Gerhard Visagie
 *
 */
public class ScraperSessionInterfaceMock implements ScraperSessionInterface {
	private String url;
	private Calendar dateTime;
	private  ArrayList<ScrapeDataPairInterface> dataPairs;
	
	/* (non-Javadoc)
	 * @see za.ac.wits.elen7045.scraper.interfaces.ScraperSessionInterface#getUrl()
	 */
	@Override
	public String getUrl() {
		// TODO Auto-generated method stub
		return this.url;
	}
	
	public void setUrl(String url){
		this.url = url;
	}
	/* (non-Javadoc)
	 * @see za.ac.wits.elen7045.scraper.interfaces.ScraperSessionInterface#getDateTime()
	 */
	@Override
	public long getDateTime() {
		// TODO Auto-generated method stub
		return this.dateTime.getTimeInMillis();
	}

	public void setDateTime(Calendar dateTime){
		this.dateTime = dateTime;
	}
	
	public void setDataPairs(ArrayList<ScrapeDataPairInterface> dataPairs){
		this.dataPairs = dataPairs;
	}

	@Override
	public ScrapeDataPairInterface get(String key) {
		for(ScrapeDataPairInterface datapair:dataPairs){
			if(datapair.getKey().equals(key)){
				return datapair;
			}
		}
		return null;
	}

	@Override
	public ArrayList<ScrapeDataPairInterface> getDataPairs() {
		return this.dataPairs;
	}

	@Override
	public void addDataPair(ScrapeDataPairInterface dataPair) {
		// TODO Auto-generated method stub
		
	}
}
